﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using YellowMap.Resources;
using System.Windows.Media;
using System.Windows.Documents;

namespace YellowMap.View.Page
{
    public partial class Policy : PhoneApplicationPage
    {
        public Policy()
        {
            InitializeComponent();
            ReloadLanguage(AppViewModel.Instance.SettingVM.Language);

            if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] != Visibility.Visible)
            {                
                LayoutRoot.Background = new SolidColorBrush(AppViewModel.Instance.SettingVM.BGColor_screen);

                titVisualMap.Foreground = new SolidColorBrush(AppViewModel.Instance.SettingVM.BGColor_Text);
                titPolicy.Foreground = new SolidColorBrush(AppViewModel.Instance.SettingVM.BGColor_Text);
            }

        }

        private void ReloadLanguage(string languageName)
        {

            switch (languageName)
            {
                case "Vi":

                    titPolicy.Text = LangVi.strPolicyHeading;


                    Run r1vi = new Run();
                    r1vi.Text = LangVi.strPolicyPara1;
                    Paragraph p1vi = new Paragraph();
                    p1vi.Inlines.Add(r1vi);
                    txtPara1.Blocks.Clear();
                    txtPara1.Blocks.Add(p1vi);
                    
                    Run r2vi = new Run();
                    r2vi.Text = LangVi.strPolicyPara2;
                    Paragraph pvi = new Paragraph();
                    pvi.Inlines.Add(r2vi);
                    txtPara2.Blocks.Clear();
                    txtPara2.Blocks.Add(pvi);

                    txtPara3.Text = LangVi.strPolicyPara3;
                    Run r4vi = new Run();
                    r4vi.Text = LangVi.strPolicyPara4;
                    Paragraph p4vi = new Paragraph();
                    p4vi.Inlines.Add(r4vi);
                    txtPara4.Blocks.Clear();
                    txtPara4.Blocks.Add(p4vi);

                    txtPara5Title.Text = LangVi.strPolicyPara5Title;

                    Run r5vi = new Run();
                    r5vi.Text = LangVi.strPolicyPara5;
                    Paragraph p5vi = new Paragraph();
                    p5vi.Inlines.Add(r5vi);
                    txtPara5.Blocks.Clear();
                    txtPara5.Blocks.Add(p5vi);

                    txtPara6Title.Text = LangVi.strPolicyPara6Title;
                    txtPara6.Text = LangVi.strPolicyPara6;

                    txtPara7Title.Text = LangVi.strPolicyPara7Title;
                    Run r7vi = new Run();
                    r7vi.Text = LangVi.strPolicyPara7;
                    Paragraph p7vi = new Paragraph();
                    p7vi.Inlines.Add(r7vi);
                    txtPara7.Blocks.Clear();
                    txtPara7.Blocks.Add(p7vi);

                    txtPara8Title.Text = LangVi.strPolicyPara8Title;
                    Run r8vi = new Run();
                    r8vi.Text = LangVi.strPolicyPara8;
                    Paragraph p8vi = new Paragraph();
                    p8vi.Inlines.Add(r8vi);
                    txtPara8.Blocks.Clear();
                    txtPara8.Blocks.Add(p8vi);


                    txtPara9Title.Text = LangVi.strPolicyPara9Title;
                    Run r9vi = new Run();
                    r9vi.Text = LangVi.strPolicyPara9;
                    Paragraph p9vi = new Paragraph();
                    p9vi.Inlines.Add(r9vi);
                    txtPara9.Blocks.Clear();
                    txtPara9.Blocks.Add(p9vi);

                    break;
                case "En":

                    titPolicy.Text = LangEn.strPolicyHeading;
                    Run r1 = new Run();                  
                    r1.Text = LangEn.strPolicyPara1;
                    Paragraph p1 = new Paragraph();
                    p1.Inlines.Add(r1);
                    txtPara2.Blocks.Clear();
                    txtPara2.Blocks.Add(p1);

                    Run r2 = new Run();                  
                    r2.Text = LangEn.strPolicyPara2;
                    Paragraph p = new Paragraph();
                    p.Inlines.Add(r2);
                    txtPara2.Blocks.Clear();
                    txtPara2.Blocks.Add(p);

                    txtPara3.Text = LangEn.strPolicyPara3;
                    Run r4 = new Run();                 
                    r4.Text = LangEn.strPolicyPara4;
                    Paragraph p4 = new Paragraph();
                    p4.Inlines.Add(r4);
                    txtPara5.Blocks.Clear();
                    txtPara5.Blocks.Add(p4);

                    txtPara5Title.Text = LangEn.strPolicyPara5Title;

                    Run r5 = new Run();                 
                    r5.Text = LangEn.strPolicyPara5;
                    Paragraph p5 = new Paragraph();
                    p5.Inlines.Add(r5);
                    txtPara5.Blocks.Clear();
                    txtPara5.Blocks.Add(p5);
                    
                    txtPara6Title.Text = LangEn.strPolicyPara6Title;
                    txtPara6.Text = LangEn.strPolicyPara6;

                    txtPara7Title.Text = LangEn.strPolicyPara7Title;

                    Run r7 = new Run();
                    r7.Text = LangEn.strPolicyPara7;
                    Paragraph p7 = new Paragraph();
                    p7.Inlines.Add(r7);
                    txtPara7.Blocks.Clear();
                    txtPara7.Blocks.Add(p7);
                    

                    txtPara8Title.Text = LangEn.strPolicyPara8Title;

                    Run r8 = new Run();
                    r8.Text = LangEn.strPolicyPara8;
                    Paragraph p8 = new Paragraph();
                    p8.Inlines.Add(r8);
                    txtPara8.Blocks.Clear();
                    txtPara8.Blocks.Add(p8);
                    ////txtPara8.Text = LangEn.strPolicyPara8;

                    txtPara9Title.Text = LangEn.strPolicyPara9Title;
                    Run r9 = new Run();
                    r9.Text = LangEn.strPolicyPara9;
                    Paragraph p9 = new Paragraph();
                    p9.Inlines.Add(r9);
                    txtPara9.Blocks.Clear();
                    txtPara9.Blocks.Add(p9);

                   
                    break;
            }
        }
    }
}